# ReadMe file for "Characterizing Agencies’ Political Environments: Partisan Agreement and Disagreement in the U.S. Executive Branch"

## Code

- `01_estimate_latent_disagreement.R`: code to estimate the latent trait model
- `02_format_latent_disagreement.R`: code to rescale posterior distribution of the latent traits to be N(0,1) and save data sets of partisan disagreement for agencies (01_dis_data.R), missions (02_mis_data.RData), and posterior draws (03_dis_draws.R and 04_mis_draws.RData).
- `03_merge_latent_traits.R`: Merge partisan disagreement estimates with Richardson, Clinton, and Lewis's (2018) estimates of agency ideology and workforce skill - creates `05_dis_data_w_traits.RData`
- `04_main_text_code_pty_dis.R`: code to create figures in the main text
- `05_appendix_code_text_pty_dis.R`: code to create figures and execute analysis in the appendix
- `pty_dis_non_centered.stan`: Stan model for estimating partisan disagreement

## Data availability

Individual-level survey data are not included in these replication files in accordance with IRB protocols to protect respondent anonymity. As a result, the data used in `01_estimate_latent_disagreement.R` and `02_format_latent_disagreement.R` are not included. The code is nonetheless included to make as much material for replication available as possible.

## Data folder

- `01_dis_data.RData`: Partisan disagreement for agencies
- `02_mis_data.RData`: Partisan disagreement for missions
- `03_dis_draws.RData`: Posterior draws of partisan disagreement for agencies
- `04_mis_draws.RData`: Posterior draws of partisan disagreement for missions
- `05_dis_data_w_traits.RData`: Partisan disagreement for agencies merged with RCL's agency ideology and workforce skills estimates
- `06_confirmation_votes.RData`: Partisan disagreement, agency ideology, and data on confirmation votes during the 117th Congress used to validate estimates of partisan disagreement in Section A.6.3 in the appendix
- `07_agenda_ch_means.RData`: Agency-level mean perceptions of agenda change for Figure A.5
- `fig_a_1_dis_means.csv`: Agency-level means of frequency and strength questions for Figure A.1 
- `table_a_1.csv`: Proportions for Table A.1 
- `rcl_ideology_estimates.csv`: RCL's publicly-available ideology estimates from replication files for that paper
- `rcl_skills_estimates.csv`: RCL's publicly-available skills estimates from replication files for that paper

## Codebook

`richardson_pty_dis_codebook.pdf`: Codebook that defines variables in each data set

## Software

R was used for data wrangling, creating figures, and estimating statistical models. The Bayesian model was fit with RStan version 2.21.3. Details on the Bayesian model are found in `01_estimate_latent_disagreement.R`, `pty_dis_non_centered.stan`, and the codebook. For details on RStan, refer to https://mc-stan.org/users/interfaces/rstan.
